<?php echo $this->headScript()->appendFile($this->baseUrl().'/javascript/library/jquery-1.5.1.js')?>
<h2>Rss</h2>
<ul id='rss_block'>
	<a href="<?php echo $this->url(array( 'action' => 'add')); ?>">
   		add rss
	</a>
    <?php
    $removed_links = array();
    foreach($this->links as $k=>$link) : ?>
		<?php if(in_array($k,$removed_links)){continue;}?>
 		<li><h2><?php echo $this->escape($link->category);?></h2></li>
        <ul>
        <?php $category_id = $link->category_id; ?>
    	<?php foreach($this->links as $key=>$category_link):?>
        <?php if($category_id == $category_link->category_id ){ ?>
        	<li>
             <a  href="<?php echo $this->url(array('controller' => 'news', 'action' => 'index', 'link_id' => $category_link->id)); ?>">
             	<?php echo $this->escape($category_link->title)?>
             </a>
             <span  class='action_block'>
             <a href="<?php echo $this->url(array( 'action' => 'edit', 'link_id' => $category_link->id)); ?>">
             	edit
             </a>
             |
             <a class='delete' href="<?php echo $this->url(array( 'action' => 'delete', 'link_id' => $category_link->id)); ?>">
             	delete
             </a>
             </span>
             
             <a	class='link_cloud' href='<?php echo $this->url(array( 'action'=>'index', 'link_id' => $category_link->id)); ?>'>
			 </a>
			 
			<!--  ************Local Cluod of Tags ************* -->

        </li>
        <?php
        //delete current array elemt to accelerate process
        //and to avoid doubling
        $removed_links[] = $key;
        //unset($this->links[$key]);
        }?>

        <?php endforeach;
        //var_dump($key_array);
        //exit;
        ?>
		</ul>

    <?php endforeach; ?>
</ul>
<h2>Tags</h2>
<div id="cloud">
	<?php
		$min = 10;
		$max = 30;
	?>
    <?php foreach ($this->cloudTags  as $tag):?>
	<?php

		if(($max - $tag->general_number) >= $min){
			$size = $min + $tag->general_number;
		}else{
			$size = $max;
		}
	?>
	<span class='kword' style='font-size:<?php echo $size;?>px';>
		<a href='<?php echo $this->url(array('controller'=>'archive','action'=>'index','tag_id'=>$tag->tag_id));?>'>
			<?php echo $tag->tag.'&nbsp;('.$tag->general_number.')';?>
		</a>
	</span>
	<?php endforeach;?>
</div>
<!-- *************** in case of deleting of link********* -->
<div id='delete_block'>
	<h4>do you really want to delete this item?</h4>
	<a class='delete_yes' href=''>
	yes</a>

	<a class='delete_no' href=''>no</a>

<!-- here will be an link cloud( on event of click on .link_cloud )  -->
</div>

<div id='float_tags_cloud'>
	<div id='close_float_tags_cloud'></div>
</div>
<?php echo $this->InlineScript()->appendFile($this->baseUrl().'/javascript/tags/tags.js');?>
